use crate::jsonrpc_common::JsonRpcError;

#[derive(Debug)]
pub(crate) enum RpcError {
    InvalidParams,
    MethodNotFound,
    InternalError,
}

impl RpcError {
    fn into_rpc_error(self) -> JsonRpcError {
        match self {
            RpcError::InvalidParams => JsonRpcError {
                code: -32602,
                message: "Invalid params".to_string(),
                data: None,
            },
            RpcError::MethodNotFound => JsonRpcError {
                code: -32601,
                message: "Method not found".to_string(),
                data: None,
            },
            RpcError::InternalError => JsonRpcError {
                code: -32603,
                message: "Internal error".to_string(),
                data: None,
            },
        }
    }
}